package com.woniuxy.lab.woniu_lab_boss.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.woniuxy.lab.woniu_lab_boss.common.Result;
import com.woniuxy.lab.woniu_lab_boss.model.Log;
import com.woniuxy.lab.woniu_lab_boss.service.LogService;
import com.woniuxy.lab.woniu_lab_boss.service.dto.LogDto;
import com.woniuxy.lab.woniu_lab_boss.service.dto.OrderDto;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.Min;

/**
 * <p>
 * 靶场日志表 前端控制器
 * </p>
 *
 * @author Silas
 * @since 2023-03-15
 */
@RestController
@RequestMapping("/log")
@Slf4j
@Api(tags = "[E]靶场日志相关接口")
public class LogController {
    @Resource
    private LogService logService;

    /**
     * 查询试验记录
     * @param
     * @return
     */
    @ApiOperation("85 查看所有实验日志")
    @GetMapping("findExperLog")
    public Result<IPage<LogDto>> findExperLog(@ApiParam(value = "第几页") @Min(value = 1,message="页码必须大于1") Integer page,
                                              @ApiParam(value = "每页条数") @Min(value = 1,message="每页展示数必须大于1")  Integer size) {
        log.info("查看所有实验日志{}{}", page, size);
        IPage<LogDto> all = logService.findAll(page, size);
        return Result.success(200, "查询实验记录成功", all);
    }
}

